import Server from './server';
import { Message } from 'element-ui';

class API extends Server {
	//注册用户
	async usersRegest(params = {}) {
		let result = await this.axios('post', '/users/regest', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//用户登录
	async usersLogin(params = {}) {
		let result = await this.axios('post', '/users/login', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//查询用户根据参数
	async findUser(params={}){
		let result = await this.axios('get', '/users/findUser', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//添加朋友
	async addFrend(params={}){
		let result = await this.axios('post', '/friend/addFrend', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//查询好友
	async findFrendList(params={}){
		let result = await this.axios('get', '/friend/findFrendList', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//获取消息列表
	async getMessage(params={}){
		let result = await this.axios('get', '/friend/getMessage', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//ubmitMessage发送消息
	async submitMessage(params={}){
		let result = await this.axios('post', '/friend/submitMessage', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}
	//获取群列表
	async getGroupList(params={}){
		let result = await this.axios('get', '/getGroupList', params);
		try {
			if (result) {
				return result || {}
			}
		} catch (error) {
			throw error;
		}
	}

}



export default new API();
